Skip to content

fix: resolve Claude hook paths without CLAUDE_SKILL_DIR#1873

Open
maxpetrusenkoagent wants to merge 1 commit into
garrytan:mainfrom
maxpetrusenkoagent:hermes/oss-pr-2026-06-05-openclaw-1871-reviewfix
Open

fix: resolve Claude hook paths without CLAUDE_SKILL_DIR#1873
maxpetrusenkoagent wants to merge 1 commit into
garrytan:mainfrom
maxpetrusenkoagent:hermes/oss-pr-2026-06-05-openclaw-1871-reviewfix

Conversation

@maxpetrusenkoagent

Copy link
Copy Markdown

Summary

Fixes skill-frontmatter PreToolUse hook commands that depended on CLAUDE_SKILL_DIR, which Claude Code 2.1.x does not populate for these hooks.

This avoids replacing one env assumption with another:

  • resolve repo-local .claude/skills/gstack/... first, covering setup --local
  • fall back to $HOME/.claude/skills/gstack/..., covering global installs
  • exit 0 if no installed hook script exists, preserving current non-blocking behavior instead of failing every tool call

Affected hook surfaces:

  • careful
  • freeze
  • guard
  • investigate

Verification

  • ulimit -n 4096; bun test test/gen-skill-docs.test.ts
  • 391 pass, 0 fail

Review Context

Supersedes the closed duplicate attempt in #1872 and addresses the same root issue discussed in #1141 without depending on either CLAUDE_SKILL_DIR or CLAUDE_PLUGIN_ROOT.

@trunk-io

trunk-io Bot commented Jun 5, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@maxpetrusenkoagent maxpetrusenkoagent force-pushed the hermes/oss-pr-2026-06-05-openclaw-1871-reviewfix branch from 9ac91ea to 08f66bd Compare June 5, 2026 03:02
@maxpetrusenkoagent

Copy link
Copy Markdown
Author

Addressed second Codex reviewer blocker.

Reviewer finding:

  • The prior local lookup used git rev-parse --show-toplevel, which could miss project-local installs from nested non-git directories or nested repos.

Fix:

  • Removed git rev-parse from hook lookup.
  • Removed any CLAUDE_PLUGIN_ROOT dependency.
  • Hook commands now walk upward from $PWD looking for .claude/skills/gstack/....
  • Then they fall back to $HOME/.claude/skills/gstack/....

New regression coverage:

  • Executes the generated careful hook command from a nested non-git cwd.
  • The fake project-local .claude/skills/gstack/careful/bin/check-careful.sh is found and executed.

Verification:

  • ulimit -n 4096; bun test test/gen-skill-docs.test.ts
  • 392 pass, 0 fail

@maxpetrusenkoagent

Copy link
Copy Markdown
Author

Codex autoreview pass: CLEAN.

Reviewer scope:

Verdict:

  • No blocking findings remain.

Verification already run:

  • ulimit -n 4096; bun test test/gen-skill-docs.test.ts
  • 392 pass, 0 fail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant